package com.joker.aigc.bi.domain.enums;


import lombok.Getter;

/**
 * @description: 数据库类型枚举
 * @author: feixiang.li
 * @date: 2025-01-17 17:05
 */
@Getter
public enum SqlTypeEnum {

    MYSQL("mysql", "mysql"),
    POSTGRESQL("postgresql", "postgresql"),
    ORACLE("oracle", "oracle"),
    SQLSERVER("sqlserver", "sqlserver"),
    ;

    private final String type;

    private final String value;

    SqlTypeEnum(String type, String value) {
        this.type = type;
        this.value = value;
    }


    public static SqlTypeEnum getEnumByType(String type) {
        for (SqlTypeEnum sqlTypeEnum : SqlTypeEnum.values()) {
            if (sqlTypeEnum.getType().equals(type)) {
                return sqlTypeEnum;
            }
        }
        return null;
    }

    public static SqlTypeEnum getEnumByValue(String value) {
        for (SqlTypeEnum sqlTypeEnum : SqlTypeEnum.values()) {
            if (sqlTypeEnum.getValue().equals(value)) {
                return sqlTypeEnum;
            }
        }
        return null;
    }
}
